import React,{Component} from 'react'
import PubSub from 'pubsub-js'

export default class Search extends Component{

    constructor() {
        super()
        this.state = {}
    }

    search = () => {
        //发布广播
        PubSub.publish('search', this.refs.search.value);
    }

    render(){
        return(
            <div className="jumbotron">
                <h1>Github大佬搜索器</h1>
                <p>搜索Github上的大佬</p>
                <div className="input-group">
                    <input type="text" className="form-control" placeholder="请输入你喜欢的的技术,例如 python" ref='search'/>
                    <span className="input-group-btn">
                        <button className="btn btn-default" type="button" onClick={this.search}>Go!</button>
                    </span>
                </div>             
            </div>
        )
    }
}